home *** CD-ROM | disk | FTP | other *** search
/ Small Time Crooks Press Kit / Small Time Crooks Press Kit.iso / pc / Small Time Crooks.dxr / Scripts_22_Photo Select-Toggle Button.ls < prev    next >
Encoding:
Text File  |  2000-04-30  |  4.6 KB  |  144 lines

  1. property pPhotoName, pWhatChanges, pWhatShows, pDestination, pGroupName, pInitialState, pNumStates, pComplexString, ancestor
  2. global gCurrentPhoto, gDownloadPhotos
  3.  
  4. on beginSprite me
  5.   set previousItemDelimiter to the itemDelimiter
  6.   set the itemDelimiter to "."
  7.   set pPhotoName to item 1 of the name of the member of sprite the spriteNum of me
  8.   set the itemDelimiter to previousItemDelimiter
  9.   if pWhatShows = #gCurrentPhotoStatus then
  10.     if pInitialState = #on then
  11.       set gCurrentPhoto to pPhotoName
  12.       sendAllSprites(#UpdateDetail, #photo)
  13.     end if
  14.   else
  15.     if pWhatShows = #selectedToDownLoadStatus then
  16.       if pPhotoName = "gCurrent" then
  17.         if getPos(gDownloadPhotos, gCurrentPhoto) then
  18.           set pInitialState to #on
  19.         else
  20.           set pInitialState to #off
  21.         end if
  22.       else
  23.         if getPos(gDownloadPhotos, pPhotoName) then
  24.           set pInitialState to #on
  25.         else
  26.           set pInitialState to #off
  27.         end if
  28.       end if
  29.     end if
  30.   end if
  31.   if pNumStates = #complex then
  32.     set pNumStates to value(pComplexString)
  33.   end if
  34.   set numTrans to pNumStates
  35.   if pWhatShows = #nothing then
  36.     set togSty to 0
  37.   else
  38.     set togSty to 1
  39.   end if
  40.   set selfTog to pWhatChanges = pWhatShows
  41.   set togGrup to pGroupName
  42.   set togState to pInitialState
  43.   if pWhatShows = #gCurrentPhotoStatus then
  44.     set togOffbl to 0
  45.   else
  46.     if pWhatShows = #selectedToDownLoadStatus then
  47.       set togOffbl to 1
  48.     end if
  49.   end if
  50.   if pWhatChanges = #gCurrentPhotoStatus then
  51.     set togOnOthOff to 1
  52.   else
  53.     set togOnOthOff to 0
  54.   end if
  55.   set ancestor to new(script "Bitmap But 1", the spriteNum of me, numTrans, togSty, togGrup, togState, togOffbl, selfTog, togOnOthOff)
  56.   UpdateWhatItShows(me)
  57. end
  58.  
  59. on MouseUpAction me
  60.   if pWhatChanges = #gCurrentPhotoStatus then
  61.     set gCurrentPhoto to pPhotoName
  62.     sendAllSprites(#UpdateDetail, #text)
  63.     sendAllSprites(#UpdateWhatItShows)
  64.   else
  65.     if pWhatChanges = #selectedToDownLoadStatus then
  66.       if pPhotoName = "gCurrent" then
  67.         if not getPos(gDownloadPhotos, gCurrentPhoto) then
  68.           append(gDownloadPhotos, gCurrentPhoto)
  69.         else
  70.           deleteAt(gDownloadPhotos, getPos(gDownloadPhotos, gCurrentPhoto))
  71.         end if
  72.       else
  73.         if not getPos(gDownloadPhotos, pPhotoName) then
  74.           append(gDownloadPhotos, pPhotoName)
  75.         else
  76.           deleteAt(gDownloadPhotos, getPos(gDownloadPhotos, pPhotoName))
  77.         end if
  78.       end if
  79.     end if
  80.   end if
  81.   if pDestination <> EMPTY then
  82.     go(pDestination)
  83.   end if
  84. end
  85.  
  86. on MouseDownAction me
  87.   nothing()
  88. end
  89.  
  90. on MouseEnterAction me
  91.   nothing()
  92. end
  93.  
  94. on MouseLeaveAction me
  95.   nothing()
  96. end
  97.  
  98. on UpdateWhatItShows me
  99.   if pWhatShows = #selectedToDownLoadStatus then
  100.     if pPhotoName = "gCurrent" then
  101.       if getPos(gDownloadPhotos, gCurrentPhoto) then
  102.         set state to #on
  103.       else
  104.         set state to #off
  105.       end if
  106.     else
  107.       if getPos(gDownloadPhotos, pPhotoName) then
  108.         set state to #on
  109.       else
  110.         set state to #off
  111.       end if
  112.     end if
  113.     if not (state = the pToggleState of me) then
  114.       set the pToggleState of me to state
  115.       setstate(me, the pCurrentState of me)
  116.     end if
  117.   end if
  118. end
  119.  
  120. on getPropertyDescriptionList me
  121.   set description to [:]
  122.   addProp(description, #pInitialState, [#default: #off, #format: #symbol, #comment: "Initial State", #range: [#off, #on]])
  123.   addProp(description, #pWhatChanges, [#default: #gCurrentPhotoStatus, #format: #symbol, #comment: "What It Changes", #range: [#nothing, #gCurrentPhotoStatus, #selectedToDownLoadStatus]])
  124.   addProp(description, #pWhatShows, [#default: #gCurrentPhotoStatus, #format: #symbol, #comment: "What It Shows", #range: [#nothing, #gCurrentPhotoStatus, #selectedToDownLoadStatus]])
  125.   addProp(description, #pGroupName, [#default: "PhotoButtons", #format: #string, #comment: "Toggle Group Name"])
  126.   addProp(description, #pDestination, [#default: EMPTY, #format: #string, #comment: "Frame Destination"])
  127.   addProp(description, #pNumStates, [#default: 3, #format: #symbol, #comment: "Number of States", #range: [2, 3, 4, 5, 6, #complex]])
  128.   addProp(description, #pComplexString, [#default: "[[1,0],[1,0],[1,0],[#m,0],[#m,0],[#m,0]]", #format: #string, #comment: "Complex State Description"])
  129.   return description
  130. end
  131.  
  132. on getBehaviorDescription me
  133.   set endChar to offset("--END OF HEADER", the text of me)
  134.   set endLine to the number of lines in char 1 to endChar of the text of me - 1
  135.   set description to line 1 to endLine of the text of me
  136.   repeat with whichLine = endLine down to 1
  137.     if line whichLine of description = EMPTY then
  138.       delete line whichLine of description
  139.     end if
  140.   end repeat
  141.   delete line 1 of description
  142.   return description
  143. end
  144.